# -*- coding: UTF-8 -*-
from django.db import models
from django.contrib.auth.models import User
from django import forms
from django.db import models

# Create your models here.
# Create your models here.
# Opisuje wszystkie możliwe do użycia przełączniki.
# Na podstawie tych wartości generowanych jest widok
# dla użytkownika (true/false - pokaż/ukryj).
class HostPermissionForOption(models.Model):
    # Bind permission to the user
    user = models.ForeignKey(User)
    IPv4Option = models.BooleanField(default=1, verbose_name="-IPv4")
    IPv6Option = models.BooleanField(default=1, verbose_name="-IPv6")
    aOption = models.BooleanField(default=1, verbose_name="-a")
    C_Option = models.BooleanField(default=1, verbose_name="-C")
    dOption = models.BooleanField(default=1, verbose_name="-d")
    lOption = models.BooleanField(default=1, verbose_name="-l")
    rOption = models.BooleanField(default=1, verbose_name="-r")
    iOption = models.BooleanField(default=1, verbose_name="-i")
    T_Option = models.BooleanField(default=1, verbose_name="-T")
    wOption = models.BooleanField(default=1, verbose_name="-w")
    vOption = models.BooleanField(default=1, verbose_name="-v")

# Opisuje wszystkie możliwe do użycia parametry.
# Na podstawie tych wartości generowanych jest widok
# dla użytkownika (true/false - pokaż/ukryj).
class HostPermissionForParameter(models.Model):
    # Bind permission to the user
    user = models.ForeignKey(User)
    cOption = models.BooleanField(default=1, verbose_name="-c class")
    N_Option = models.BooleanField(default=1, verbose_name="-N ndots")
    tOption = models.BooleanField(default=1, verbose_name="-t type")
    W_Option = models.BooleanField(default=1, verbose_name="-W wait")
    R_Option = models.BooleanField(default=1, verbose_name="-R number")
    
# Opisuje formularz, jaki zostanie wygenerowany dla parametrów polecenia.
# Definiuje walidację danego pola, jego etykietę oraz tekst podpowiedzi.
class HostFormForParameters(forms.Form):
    cOption = forms.CharField(
        max_length=128,
        required = False,
        label = '-c',
        help_text = 'class')
    N_Option = forms.IntegerField(
        required = False,
        label = '-N',
        help_text = 'ndots',
        min_value = 1,)
    R_Option = forms.IntegerField(
        required = False,
        label = '-R',
        help_text = 'number',)
    tOption = forms.CharField(
        max_length=128,
        required = False,
        label = '-t',
        help_text = 'type')
    W_Option = forms.IntegerField(
        required = False,
        label = '-W',
        help_text = 'wait',
        min_value = 1,)

# Opisuje formularz, jaki zostanie wygenerowany dla parametrów polecenia.
# Definiuje walidację danego pola, jego etykietę oraz tekst podpowiedzi.
class NameForm(forms.Form):
    name = forms.CharField(
        max_length = 128,
        required = True,
        help_text = 'name',)

# Opisuje formularz, jaki zostanie wygenerowany dla opcji polecenia.
# Definiuje walidację danego pola, jego etykietę oraz tekst podpowiedzi.
class HostFormForOptions(forms.Form):
    IPv4Option = forms.BooleanField(
        required = False,
        label = '-4',
        help_text = 'Use IPv4 query transport only')
    IPv6Option = forms.BooleanField(
        required = False,
        label = '-6',
        help_text = 'Use IPv6 query transport only')
    aOption = forms.BooleanField(
        required = False,
        label = '-a',
        help_text = 'Is equivalent to -v -t ANY')
    C_Option = forms.BooleanField(
        required = False,
        label = '-C',
        help_text = 'Compares SOA records on authoritative nameservers')
    dOption = forms.BooleanField(
        required = False,
        label = '-d',
        help_text = 'Is equivalent to -v')
    lOption = forms.BooleanField(
        required = False,
        label = '-l',
        help_text = 'Lists all hosts in a domain, using AXFR')
    rOption = forms.BooleanField(
        required = False,
        label = '-r',
        help_text = 'Disables recursive processing')
    iOption = forms.BooleanField(
        required = False,
        label = '-i',
        help_text = 'IP6.INT reverse lookups')
    T_Option = forms.BooleanField(
        required = False,
        label = '-T',
        help_text = 'Enables TCP/IP mode')
    wOption = forms.BooleanField(
        required = False,
        label = '-w',
        help_text = 'Specifies to wait forever for a reply')
    vOption = forms.BooleanField(
        required = False,
        label = '-v',
        help_text = 'Enables verbose output')
